<html>
<body>
<pre>
package project3;

import lex.Lex;
import lex.Token;
import lex.TokenType;
import lex.Constant;


public class Fact
    extends NamedList
{
//Domain Implementation
//  Identifier name -- inherited from NamedList, impliments attributeName
//  ArrayList&lt;Node&gt; nodes -- inherited from NamedList from List,
//                        -- implements constantList

//Constructors
    <a name="LexConstructor"/>
    public Fact(Lex lex)
        throws ParserException
    {
        super(lex);
        checkFor(lex, TokenType.PERIOD);

        for(Node node : nodes){
            Domain.add((Constant)node);
        };
    }

//Queries
    <a name="toString"/>
    public String toString()
    {
        return super.toString() + ".";
    }

//Commands

//Auxillary Methods and Constants
    //Methods defined in List that are overridden to define a Fact.
    <a name="createNode"/>
    protected Node createNode(Lex lex)
        throws ParserException
    {
        //The lexical analyzer returns a Constant with TokenType == STRING
        return checkFor(lex, TokenType.STRING);
    }

    <a name="isInFirstElement"/>
    protected boolean isInFirstOfListElement(Lex lex)
    {
        assert lex != null;

        return lex.front() instanceof Constant;
    }
}
</pre>
</body>
</html>
